import React, { Component } from "react";

import { connect } from 'dva';

import { Tabs } from 'antd';

import QrcodeOwner from '@/pages/data/qrcode_owner';
import QrcodeBuild from '@/pages/data/qrcode_build';
import QrcodeFloor from '@/pages/data/qrcode_floor';
import QrcodePosition from '@/pages/data/qrcode_position';
import QrcodeDevice from '@/pages/data/qrcode_device';
import QrcodePart from '@/pages/data/qrcode_part';
import QrcodeFacility from '@/pages/data/qrcode_facility';
import QrcodeBlank from '@/pages/data/qrcode_blank';
import { checkInit } from '@/utils/util';

const TabPane = Tabs.TabPane;

@connect()
class Qrcode extends Component {

  state = {
    key: '1'
  }

  componentDidMount() {
    checkInit()
  }
  

  callback = key => {
    this.setState({ key })
  }

  render() {
    const { key } = this.state;
    return (
      <>
        <Tabs onChange={this.callback} >
          <TabPane tab="空白二维码" key="1">
            {
              key === '1' && <QrcodeBlank />
            }
          </TabPane>
          <TabPane tab="单位二维码" key="2">
            {
              key === '2' && <QrcodeOwner />
            }
          </TabPane>
          <TabPane tab="建筑二维码" key="3">
            {
              key === '3' &&
              <QrcodeBuild />
            }
          </TabPane>
          <TabPane tab="楼层二维码" key="4">
            {
              key === '4' && <QrcodeFloor />
            }
          </TabPane>
          <TabPane tab="设备二维码" key="5">
            {
              key === '5' && <QrcodeDevice />
            }
          </TabPane>
          <TabPane tab="设施二维码" key="7">
            {
              key === '7' && <QrcodeFacility />
            }
          </TabPane>
          <TabPane tab="重点部位二维码" key="8">
            {
              key === '8' && <QrcodePart />
            }
          </TabPane>
          <TabPane tab="巡逻点二维码" key="6">
            {
              key === '6' && <QrcodePosition />
            }
          </TabPane>
        </Tabs>
      </>
    );
  }
}
export default Qrcode;
